<?php

/*

Update Profile (update_profile.php)

*/

$page_title = "Update Profile";
$rank_check = 1;
include "header.inc.php";

print "$openHTML";

$findProfile = fetch("SELECT * FROM members_profiles2 WHERE username = '$username' AND game = '$game'");
$explodeBday = explode("-", $findProfile[birthday]);
if ($findProfile[gender] == 1) { $selectG1 = " SELECTED"; }
if ($findProfile[gender] == 2) { $selectG2 = " SELECTED"; }
if ($findProfile[mail_settings] == 1) { $selectM1 = " SELECTED"; }
if ($findProfile[mail_settings] == 2) { $selectM2 = " SELECTED"; }
$findProfile[profile] = unsmilies($findProfile[profile]);

if ($getInfo[premium] == 1)
{
	$ifPremium = "<br><a href=update_display_name.php?game=$game>ADVANCED!</a>";
}

ECHO <<<END

<P><FORM ACTION="update_profile.pro.php?game=$game" METHOD=POST>
   <CENTER><TABLE BGCOLOR="$tableOutline" CELLSPACING=1 CELLPADDING=0 WIDTH=%90>
      <TR BGCOLOR="$topAndBottomBG">
         <TD COLSPAN=2 HEIGHT=50>
            <CENTER class=white><FONT SIZE="+2" COLOR="$topAndBottomText"><B>--My
            Profile--</B></FONT></CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>My Name*</font></P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_myname" VALUE="$findProfile[real_name]" SIZE=30></P>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>Display Name*$ifPremium</font></P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_display_name" VALUE="$display_name" SIZE=30></P>
         </TD>
      </TR>
       <TR BGCOLOR="$maincellColor">
         <TD WIDTH=125 HEIGHT=25>
            <P>Password</P>
         </TD>
         <TD>
            <P><i>Want to change your password? <a href=change_password.php?game=$game>Click here</a>!</i></a></P>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>My E-mail*</font></P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_myemail" VALUE="$findProfile[email]" SIZE=30></P>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>My Birthday*</font></P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_mybirthmonth" VALUE="$explodeBday[0]" SIZE=4 MAXLENGTH=2><INPUT TYPE=text NAME="update_mybirthday" VALUE="$explodeBday[1]" SIZE=4 MAXLENGTH=2><INPUT TYPE=text NAME="update_mybirthyear" VALUE="$explodeBday[2]" SIZE=8 MAXLENGTH=4></P>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>My Gender*</font></P>
         </TD>
         <TD>
            <P><SELECT NAME="update_my_gender">
               <OPTION VALUE="1"$selectG1>Female
               <OPTION VALUE="2"$selectG2>Male
            </SELECT></P>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=125>
            <P>My Profile</P>
         </TD>
         <TD>
            <P><TEXTAREA NAME="update_myprofile" ROWS=6 COLS=45 WRAP=virtual>$findProfile[profile]</TEXTAREA></P>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD WIDTH=125 HEIGHT=25>
            <P>Signature</P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_signature" VALUE="$findProfile[signature]" SIZE=30></P>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=125 HEIGHT=25>
            <P>Mail Settings</P>
         </TD>
         <TD>
            <P><SELECT NAME="update_mailsettings">
               <OPTION VALUE="0">Allow All
               <OPTION VALUE="1"$selectM1>Allow Buddies
               <OPTION VALUE="2"$selectM2>Block All
            </SELECT></P>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD WIDTH=125 HEIGHT=25>
            <P><font color=red>Location*</font></P>
         </TD>
         <TD>
            <P><INPUT TYPE=text NAME="update_location" VALUE="$findProfile[location]" SIZE=30></P>
         </TD>
      </TR>
      <TR BGCOLOR="$topAndBottomBG">
         <TD COLSPAN=2>
            <CENTER><INPUT TYPE=submit NAME=Submit VALUE="Update My Info!"></CENTER>
         </TD>
      </TR>
   </TABLE>
   </CENTER>
</FORM></P>

<p align=center>--<a href=user_profile.php?game=$game&user=$username>View Your Profile!</a>--</p>
END;

print "$closeHTML";
?>